package mysql

import (
	"gorm.io/gorm"
	"time"
)

type Order struct {
	gorm.Model
	UserId        int       `gorm:"type:int(10);not null;comment:'用户Id'"`
	InstitutionId int       `gorm:"type:int(10);not null;comment:'组织Id'"`
	TeamId        int       `gorm:"type:int(10);not null;comment:'团队Id'"`
	DoctorId      int       `gorm:"type:int(10);not null;comment:'医生Id'"`
	OrderSn       string    `gorm:"type:varchar(100);not null;comment:'订单号'"`
	ServicePack   string    `gorm:"type:varchar(100);not null;comment:'服务包'"`
	SingCycle     string    `gorm:"type:varchar(10);not null;comment:'签约周期'"`
	EffectiveDate time.Time `gorm:"type:datetime(3);not null;comment:'团队Id'"`
	Price         float64   `gorm:"type:double(10,2);not null;comment:'费用'"`
	Notes         string    `gorm:"type:varchar(255);not null;comment:'备注'"`
	PayWay        int       `gorm:"type:int(10);not null;comment:'支付方式: 1:余额支付 2:线上支付'"`
	OrderStatus   int       `gorm:"type:int(10);not null;comment:'订单状态: 1:未支付 2:超时已取消 3:已支付 4:已完成'"`
}

func OrderCreate(order *Order) error {
	return DB.Debug().Create(&order).Error
}
